﻿CREATE PROCEDURE GLREPORT 
	@MONTHREPORT INT = 0,
	@YEARREPORT INT = 0
AS
SELECT GL.DATE, 
GL.ENTITY, 
GL.FILIAL, 
SUB.CODE AS SUBCODE, 
SUB.Description AS SUBDESCRIPTION, 
GL.Money, 
S.Code AS SECTORCODE,
GL.LINE, 
GL.Value, 
GL.TRANSACTIONTYPE,
GL.TransactionCode,
GL.OPInput,
GL.OPAuth,
GL.Module,
GL.PROVE,
GL.EVENTCODE,
GL.EVENTNUMBER,
GL.HISTORICONE,
GL.HISTORICTWO FROM GL AS GL
INNER JOIN SECTOR AS S ON
GL.SECTORID = S.ID
INNER JOIN Subsidiary AS SUB ON
GL.SUBSIDIARYID = SUB.ID
WHERE GL.ReportFlag = 1 AND MONTH(DATE) = @MONTHREPORT AND YEAR(DATE) = @YEARREPORT